package cn.sdhuijin.healthexam.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;
import cn.sdhuijin.healthexam.util.Constants;

/**
 * 糖尿病随访第一页
 * 
 * @author sunping
 */
public class EditVisitDiabetesFirstActivity extends AbstractControlActivity
		implements OnClickListener {

	private String createDate;

	private int[] cbSymptoms = { R.id.check_symptom_wu,
			R.id.check_symptom_drink_more, R.id.check_symptom_eat_more,
			R.id.check_symptom_polyuria, R.id.check_symptom_blurred_vision,
			R.id.check_symptom_infected, R.id.check_symptom_numb,
			R.id.check_symptom_lower_extremities, R.id.check_symptom_decreased };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_edit_diabetes_first);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		Bundle bundle = intent.getBundleExtra("bundle");
		if (bundle != null) {
			createDate = bundle.getString("createDate");
		}
		setCurrentEditUserName(createDate);

		addEditTextView(R.id.edt_name, "姓名");
		addEditTextView(R.id.edt_identify_num, "身份证号");
		addRadioGroupView(R.id.rad_visit_way, "随访方式");
		addEditTextView(R.id.edt_visit_date, "随访日期");
		addCheckBoxGroupView(cbSymptoms, "症状", R.id.edt_symptom_other, "症状其他",
				"无症状");
		addEditTextView(R.id.edt_blood_pressure, "高压");
		addEditTextView(R.id.edt_blood_pressure_low, "低压");
		addEditTextView(R.id.edt_weight, "体重");
		addEditTextView(R.id.edt_mass_index, "体质指数");
		addRadioGroupView(R.id.rad_pulse, "足背动脉搏动");
		addEditTextView(R.id.edt_other, "体征其他");
		addEditTextView(R.id.edt_smoke, "日吸烟量");
		addEditTextView(R.id.edt_drink, "日饮酒量");
		addEditTextView(R.id.edt_sports_week, "运动次数");
		addEditTextView(R.id.edt_sports_minute, "运动时间");
		addEditTextView(R.id.edt_staples, "主食");
		addRadioGroupView(R.id.rad_emotional_adjust, "心理调整");

		controlManager.setPropertiesPath(Constants.PROPERTIES_PATH + createDate
				+ ".txt");
		Log.i(EditPersonDocFirstActivity.class.getSimpleName(), "文件路径： "
				+ Constants.PROPERTIES_PATH + createDate + ".txt");
		controlManager.toControl();

		setEditTextListener(R.id.edt_visit_date);
		this.setButtonListener(this, R.id.btn_next, R.id.btn_back);
	}

	@Override
	public void onClick(View v) {
		Intent intent = new Intent();
		Bundle bundle = new Bundle();
		int clickId = (Integer) v.getId();
		switch (clickId) {
		case R.id.btn_next:
			controlManager.toProperties();
			intent.setClass(this, EditVisitDiabetesSecondActivity.class);
			bundle.putString("createDate", createDate);
			intent.putExtra("bundle", bundle);
			startActivity(intent);
			this.finish();
			break;
		case R.id.btn_back:
			finish();
			break;
		default:
			break;
		}

	}

}
